import { Redirect, Route, Switch } from 'react-router-dom'
import { loadable } from '../utils/tool'
import routes from '../router/routeAry'
const Home = loadable({
  loader: () => import('../views/home')
})
const About = loadable({
  loader: () => import('../views/about')
})
function MyRoutes() {
  return (
    <div>
      <Switch>
        <Route path='/' exact render={() => <Redirect to='/home'></Redirect>}></Route>
        {/* <Route path='/home' component={Home} />
        <Route path='/about' component={About} /> */}
        {
          routes.map(item => <Route key={item.path} path={item.path} component={item.component} />)
        }
        <Route path='/*' render={() => <Redirect to='/404'></Redirect>}></Route>
      </Switch>
    </div>
  )

}

export default MyRoutes